package 途虎养车;

/**
 * @author tmh
 * @date 2024/9/5 18:05
 * @description
 */
public class T计算组合数 {
    public int combination (int r, int n) {
        long ans = 1;
        for (int i = 1; i < r + 1; i++) {
            ans *= n;
            n -= 1;

        }

        for (int j = 1; j < r + 1; j++) {
            ans /= j;
        }
        return (int) ans;

    }
}
